{% set uniqid = uniqid ?? uniqid('rewrite_') %}
{% set idBase = "nginx-vhosts-#{vhostId}-rewrites-#{uniqid}" %}
{% set nameBase = "nginx[vhosts][#{vhostId}][rewrites][#{uniqid}]" %}

<div id="{{ idBase }}" data-uniqid="{{ uniqid }}" data-name="{{ nameBase }}"
     class="tab-pane {{ active is defined and active ? 'active' }}">
    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-when">
            When (Optional)
        </label>
        <input type="text" id="{{ idBase }}-when"
               name="{{ nameBase }}[when]"
               placeholder="$http_user_agent ~ MSIE" class="form-control"
               value="{{ rewrite.when }}" />
        <div class="help-block">
            Wraps <code>rewrite</code> statement inside <code>if</code> block.
            <a href="http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#if"
               target="_blank">More information</a>.
        </div>
    </div>

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-regex">
            Regex
        </label>
        <input type="text" id="{{ idBase }}-regex"
               name="{{ nameBase }}[regex]"
               placeholder="^(.*)$" class="form-control"
               value="{{ rewrite.regex }}" />
        <div class="help-block">
            Regex to match against.
            <a href="http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite"
               target="_blank">More information</a>.
        </div>
    </div>

    <div class="clearfix"></div>

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-target">
            Target
        </label>
        <input type="text" id="{{ idBase }}-target"
               name="{{ nameBase }}[target]"
               placeholder="/msie/$1 break" class="form-control"
               value="{{ rewrite.target }}" />
        <div class="help-block">
            Action to take. Do not append with <code>;</code>!
            <a href="http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite"
               target="_blank">More information</a>.
        </div>
    </div>

    <div class="clearfix"></div>
</div>
